#include <stdio.h>
#include <string.h>

void multiply(int *s, int n)
{
	int x=0;
	while(*s != -1) {
		x = *s * n+x;		
		*s = x%10;
		s++;
		x /=10;
	}
	while (x) {
		*s = x%10;
		x /= 10;
		s++;
	}
	*s = -1;
}

int digitsSum(int *s)
{
	int r = 0;
	while(*s != -1)r += *(s++);
	return r;
}
int main()
{
	int s[256], a, b, sum, max=0, i;
	for (a=99; a<100; a++) {
		s[0]=1;
		s[1]=-1;
		for (b=1; b<100; b++) {
			multiply(s, a);
			sum = digitsSum(s);
			printf("%d ", sum);
			if (sum>max)max = sum;
		}
	}
	int bc[10]; 
	bc[0] = 1; bc[1] = 2; bc[2] = 4; bc[3] = -1;
	printf("\n%d %d\n", max, digitsSum(bc));

	s[0]=1;
	s[1]=-1;
	multiply(s, 10);
	multiply(s, 11);
	multiply(s, 11);
	i = 0;
	while (s[i] != -1)printf("%d", s[i++]);
	printf(" %d\n", digitsSum(s));
}
